VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "mscomctl.ocx"
Object = "{CDE57A40-8B86-11D0-B3C6-00A0C90AEA82}#1.0#0"; "MSDATGRD.OCX"
Object = "{B3FB64BF-91F9-11D7-A482-0008A14158BC}#2.22#0"; "ITGControls.ocx"
Begin VB.Form frmMaintUserParameter 
   BackColor       =   &H00F7D9C2&
   BorderStyle     =   0  'None
   Caption         =   "Form1"
   ClientHeight    =   6000
   ClientLeft      =   0
   ClientTop       =   0
   ClientWidth     =   7365
   BeginProperty Font 
      Name            =   "Tahoma"
      Size            =   8.25
      Charset         =   0
      Weight          =   400
      Underline       =   0   'False
      Italic          =   0   'False
      Strikethrough   =   0   'False
   EndProperty
   KeyPreview      =   -1  'True
   LinkTopic       =   "Form1"
   MDIChild        =   -1  'True
   ScaleHeight     =   6000
   ScaleWidth      =   7365
   ShowInTaskbar   =   0   'False
   Begin MSComctlLib.StatusBar sbRS 
      Align           =   2  'Align Bottom
      Height          =   255
      Left            =   0
      TabIndex        =   0
      Top             =   5745
      Width           =   7365
      _ExtentX        =   12991
      _ExtentY        =   450
      _Version        =   393216
      BeginProperty Panels {8E3867A5-8586-11D1-B16A-00C0F0283628} 
         NumPanels       =   2
         BeginProperty Panel1 {8E3867AB-8586-11D1-B16A-00C0F0283628} 
            Object.Width           =   3528
            MinWidth        =   3528
         EndProperty
         BeginProperty Panel2 {8E3867AB-8586-11D1-B16A-00C0F0283628} 
         EndProperty
      EndProperty
   End
   Begin ITGControls.ITGTab SSTab1 
      Height          =   4515
      Left            =   45
      TabIndex        =   1
      Top             =   1080
      Width           =   7245
      _ExtentX        =   12779
      _ExtentY        =   7964
      TabCount        =   2
      TabCaption(0)   =   "               Main               "
      TabContCtrlCnt(0)=   2
      Tab(0)ContCtrlCap(1)=   "ComunionFrames1"
      Tab(0)ContCtrlCap(2)=   "ComunionFrames2"
      TabCaption(1)   =   "               List               "
      TabContCtrlCnt(1)=   1
      Tab(1)ContCtrlCap(1)=   "dtgList"
      TabTheme        =   2
      ActiveTabBackStartColor=   16250865
      ActiveTabBackEndColor=   16243138
      InActiveTabBackStartColor=   16243138
      InActiveTabBackEndColor=   16243138
      BeginProperty ActiveTabFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "Tahoma"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      BeginProperty InActiveTabFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "Tahoma"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      OuterBorderColor=   4210752
      TopLeftInnerBorderColor=   4210752
      BottomRightInnerBorderColor=   4210752
      DisabledTabBackColor=   16243138
      DisabledTabForeColor=   -2147483630
      Begin MSDataGridLib.DataGrid dtgList 
         Height          =   4080
         Left            =   -74940
         TabIndex        =   10
         Top             =   360
         Width           =   7095
         _ExtentX        =   12515
         _ExtentY        =   7197
         _Version        =   393216
         AllowUpdate     =   0   'False
         AllowArrows     =   -1  'True
         Appearance      =   0
         HeadLines       =   1
         RowHeight       =   15
         TabAction       =   2
         FormatLocked    =   -1  'True
         BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "Tahoma"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "Tahoma"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ColumnCount     =   4
         BeginProperty Column00 
            DataField       =   "cParamID"
            Caption         =   "Parameter ID"
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   0
               Format          =   ""
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   1033
               SubFormatType   =   0
            EndProperty
         EndProperty
         BeginProperty Column01 
            DataField       =   "cParamName"
            Caption         =   "Parameter Name"
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   1
               Format          =   "MM/dd/yyyy"
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   1033
               SubFormatType   =   3
            EndProperty
         EndProperty
         BeginProperty Column02 
            DataField       =   "cValue"
            Caption         =   "Value"
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   0
               Format          =   ""
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   1033
               SubFormatType   =   0
            EndProperty
         EndProperty
         BeginProperty Column03 
            DataField       =   "cType"
            Caption         =   "Type"
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   0
               Format          =   ""
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   1033
               SubFormatType   =   0
            EndProperty
         EndProperty
         SplitCount      =   1
         BeginProperty Split0 
            AllowRowSizing  =   0   'False
            BeginProperty Column00 
               ColumnAllowSizing=   -1  'True
               Locked          =   -1  'True
               ColumnWidth     =   1035.213
            EndProperty
            BeginProperty Column01 
               Locked          =   -1  'True
               ColumnWidth     =   2550.047
            EndProperty
            BeginProperty Column02 
               Locked          =   -1  'True
            EndProperty
            BeginProperty Column03 
               ColumnWidth     =   1379.906
            EndProperty
         EndProperty
      End
      Begin ITGControls.ComunionFrames ComunionFrames1 
         Height          =   1650
         Left            =   60
         Top             =   2790
         Width           =   7095
         _ExtentX        =   12515
         _ExtentY        =   2910
         FrameColor      =   4210752
         BackColor       =   16243138
         FillColor       =   16243138
         RoundedCorner   =   0   'False
         Caption         =   "Transaction ID"
         Alignment       =   0
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "Tahoma"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ThemeColor      =   5
         ColorFrom       =   16243138
         ColorTo         =   16250865
         Begin VB.Frame Frame2 
            BackColor       =   &H00F7D9C2&
            BorderStyle     =   0  'None
            Caption         =   "Frame1"
            Height          =   1110
            Left            =   75
            TabIndex        =   11
            Top             =   450
            Width           =   6975
            Begin ITGControls.ITGTextBox txtPrefix 
               Height          =   285
               Left            =   135
               TabIndex        =   12
               Top             =   135
               Width           =   3165
               _ExtentX        =   5371
               _ExtentY        =   503
               SendKeysTab     =   -1  'True
               LabelBackColor  =   16243138
               BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
                  Name            =   "Tahoma"
                  Size            =   8.25
                  Charset         =   0
                  Weight          =   400
                  Underline       =   0   'False
                  Italic          =   0   'False
                  Strikethrough   =   0   'False
               EndProperty
               Label           =   "Prefix"
               BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
                  Name            =   "Tahoma"
                  Size            =   8.25
                  Charset         =   0
                  Weight          =   400
                  Underline       =   0   'False
                  Italic          =   0   'False
                  Strikethrough   =   0   'False
               EndProperty
               LabelWidth      =   1280
               TextBoxWidth    =   1825
            End
            Begin ITGControls.ITGTextBox txtSeries 
               Height          =   285
               Left            =   135
               TabIndex        =   13
               Top             =   495
               Width           =   3165
               _ExtentX        =   5371
               _ExtentY        =   503
               SendKeysTab     =   -1  'True
               LabelBackColor  =   16243138
               BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
                  Name            =   "Tahoma"
                  Size            =   8.25
                  Charset         =   0
                  Weight          =   400
                  Underline       =   0   'False
                  Italic          =   0   'False
                  Strikethrough   =   0   'False
               EndProperty
               Label           =   "Series"
               BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
                  Name            =   "Tahoma"
                  Size            =   8.25
                  Charset         =   0
                  Weight          =   400
                  Underline       =   0   'False
                  Italic          =   0   'False
                  Strikethrough   =   0   'False
               EndProperty
               LabelWidth      =   1280
               TextBoxWidth    =   1825
            End
            Begin ITGControls.ITGTextBox txtPlaces 
               Height          =   285
               Left            =   3495
               TabIndex        =   14
               Top             =   135
               Width           =   3105
               _ExtentX        =   5265
               _ExtentY        =   503
               SendKeysTab     =   -1  'True
               LabelBackColor  =   16243138
               BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
                  Name            =   "Tahoma"
                  Size            =   8.25
                  Charset         =   0
                  Weight          =   400
                  Underline       =   0   'False
                  Italic          =   0   'False
                  Strikethrough   =   0   'False
               EndProperty
               Text            =   "0"
               DataType        =   1
               Label           =   "No. of Digits"
               BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
                  Name            =   "Tahoma"
                  Size            =   8.25
                  Charset         =   0
                  Weight          =   400
                  Underline       =   0   'False
                  Italic          =   0   'False
                  Strikethrough   =   0   'False
               EndProperty
               LabelWidth      =   1280
               TextBoxWidth    =   1765
            End
            Begin ITGControls.ITGCheckBox chkFormat 
               Height          =   300
               Left            =   3495
               TabIndex        =   15
               Top             =   495
               Width           =   1035
               _ExtentX        =   1826
               _ExtentY        =   529
               BackColor       =   16243138
               Caption         =   "Format"
               BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
                  Name            =   "Tahoma"
                  Size            =   8.25
                  Charset         =   0
                  Weight          =   400
                  Underline       =   0   'False
                  Italic          =   0   'False
                  Strikethrough   =   0   'False
               EndProperty
               Alignment       =   1
            End
            Begin ITGControls.ITGLabel txtLabel 
               Height          =   285
               Left            =   4695
               TabIndex        =   16
               Top             =   495
               Width           =   1935
               _ExtentX        =   3413
               _ExtentY        =   503
               BackColor       =   -2147483624
               BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
                  Name            =   "Tahoma"
                  Size            =   8.25
                  Charset         =   0
                  Weight          =   400
                  Underline       =   0   'False
                  Italic          =   0   'False
                  Strikethrough   =   0   'False
               EndProperty
               Alignment       =   2
            End
            Begin ITGControls.ITGTextBox txtFormat 
               Height          =   285
               Left            =   2955
               TabIndex        =   17
               Top             =   795
               Visible         =   0   'False
               Width           =   1125
               _ExtentX        =   1773
               _ExtentY        =   503
               SendKeysTab     =   -1  'True
               LabelBackColor  =   16243138
               BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
                  Name            =   "Tahoma"
                  Size            =   8.25
                  Charset         =   0
                  Weight          =   400
                  Underline       =   0   'False
                  Italic          =   0   'False
                  Strikethrough   =   0   'False
               EndProperty
               Label           =   "Prefix"
               BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
                  Name            =   "Tahoma"
                  Size            =   8.25
                  Charset         =   0
                  Weight          =   400
                  Underline       =   0   'False
                  Italic          =   0   'False
                  Strikethrough   =   0   'False
               EndProperty
               LabelWidth      =   800
               TextBoxWidth    =   265
            End
         End
      End
      Begin ITGControls.ComunionFrames ComunionFrames2 
         Height          =   2370
         Left            =   60
         Top             =   360
         Width           =   7110
         _ExtentX        =   12541
         _ExtentY        =   4180
         FrameColor      =   4210752
         BackColor       =   16243138
         FillColor       =   16243138
         RoundedCorner   =   0   'False
         Caption         =   "Information"
         Alignment       =   0
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "Tahoma"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ThemeColor      =   5
         ColorFrom       =   16243138
         ColorTo         =   16250865
         Begin VB.Timer Timer1 
            Interval        =   300
            Left            =   1515
            Top             =   570
         End
         Begin ITGControls.ITGTextBox txtType 
            Height          =   285
            Left            =   255
            TabIndex        =   4
            Top             =   2010
            Width           =   2685
            _ExtentX        =   4524
            _ExtentY        =   503
            SendKeysTab     =   -1  'True
            LabelBackColor  =   16243138
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Label           =   "Type"
            BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            LabelWidth      =   1280
            TextBoxWidth    =   1345
            Required        =   -1  'True
         End
         Begin ITGControls.ITGTextBox txtName 
            Height          =   285
            Left            =   255
            TabIndex        =   5
            Top             =   495
            Width           =   6480
            _ExtentX        =   11218
            _ExtentY        =   503
            SendKeysTab     =   -1  'True
            BackColor       =   14745599
            LabelBackColor  =   16243138
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Mandatory       =   -1  'True
            Label           =   "Parameter Name"
            BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            LabelWidth      =   1280
            TextBoxWidth    =   5140
            Required        =   -1  'True
         End
         Begin ITGControls.ITGTextBox txtDesc 
            Height          =   285
            Left            =   255
            TabIndex        =   6
            Top             =   930
            Width           =   6465
            _ExtentX        =   11192
            _ExtentY        =   503
            SendKeysTab     =   -1  'True
            LabelBackColor  =   16243138
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Label           =   "Description"
            BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            LabelWidth      =   1280
            TextBoxWidth    =   5125
            Required        =   -1  'True
         End
         Begin ITGControls.ITGTextBox txtValue 
            Height          =   285
            Left            =   255
            TabIndex        =   7
            Top             =   1290
            Width           =   6465
            _ExtentX        =   11192
            _ExtentY        =   503
            SendKeysTab     =   -1  'True
            LabelBackColor  =   16243138
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Label           =   "Value"
            BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            LabelWidth      =   1280
            TextBoxWidth    =   5125
            Required        =   -1  'True
         End
         Begin ITGControls.ITGTextBox txtModule 
            Height          =   285
            Left            =   255
            TabIndex        =   8
            Top             =   1650
            Width           =   2685
            _ExtentX        =   4524
            _ExtentY        =   503
            SendKeysTab     =   -1  'True
            LabelBackColor  =   16243138
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Label           =   "Module"
            BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            LabelWidth      =   1280
            TextBoxWidth    =   1345
         End
         Begin ITGControls.ITGTextBox txtOrder 
            Height          =   285
            Left            =   4035
            TabIndex        =   9
            Top             =   1650
            Width           =   2685
            _ExtentX        =   4524
            _ExtentY        =   503
            SendKeysTab     =   -1  'True
            LabelBackColor  =   16243138
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Text            =   "0"
            DataType        =   1
            Label           =   "Order"
            BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            LabelWidth      =   1280
            TextBoxWidth    =   1345
         End
      End
   End
   Begin VB.Label lblDetails 
      AutoSize        =   -1  'True
      BackColor       =   &H00F7D9C2&
      BackStyle       =   0  'Transparent
      Caption         =   "Parameter Type"
      ForeColor       =   &H00000000&
      Height          =   195
      Left            =   225
      TabIndex        =   3
      Top             =   600
      Visible         =   0   'False
      Width           =   1155
   End
   Begin VB.Label lblHeader 
      AutoSize        =   -1  'True
      BackColor       =   &H00F7D9C2&
      BackStyle       =   0  'Transparent
      Caption         =   "Parameter Name"
      BeginProperty Font 
         Name            =   "Tahoma"
         Size            =   12
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00000000&
      Height          =   285
      Left            =   225
      TabIndex        =   2
      Top             =   240
      Width           =   2085
   End
   Begin VB.Shape Shape1 
      BorderColor     =   &H00404040&
      Height          =   975
      Left            =   45
      Top             =   45
      Width           =   7230
   End
End
Attribute VB_Name = "frmMaintUserParameter"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'IT Group Inc. 2005.09.23

Option Explicit

'Object variables





'Recordset variables
Private WithEvents rsHeader As ADODB.Recordset
Attribute rsHeader.VB_VarHelpID = -1

'ADO Connection variables

Private connHeader As ADODB.Connection

'Form mode enumeration
Public Enum eParamMode1
    Normal
    AddNewEdit
    Find
End Enum
Private Mode As eParamMode1
'Other declaration
Public sBit As String
Private vBM As Variant 'Recordset bookmark variable
Public ParamType, lblType As String

'Security Acess Level variables
Public lACNew As Boolean
Public lACEdit As Boolean
Public lACDelete As Boolean
Public lACPost As Boolean
Public lACCancel As Boolean
Public lACPrint As Boolean

Private Sub chkFormat_Click()
Dim X
    If chkFormat.Value = Checked Then
        rsHeader!lFormat = True
        
        If Len(txtSeries) <= 15 Then
            For i = 1 To Trim(txtPlaces) - Len(txtSeries)
                X = "0" + X
            Next i
            If Len(txtPrefix) + Len(txtSeries) <= 20 Then
                txtLabel.Caption = Trim(txtPrefix) + X + Trim(txtSeries)
            End If
        End If
        
    ElseIf chkFormat.Value = Unchecked Then
        rsHeader!lFormat = False
        txtLabel.Caption = ""
    End If
End Sub

Private Sub dtgList_HeadClick(ByVal ColIndex As Integer)
    SortGrid dtgList, ColIndex, rsHeader
End Sub

Private Sub Form_KeyUp(KeyCode As Integer, Shift As Integer)
Dim iKey As Integer
    iKey = ToolbarIndex(KeyCode, Shift)
    If iKey <> 0 Then
        If ITGLedgerMain.tbrMain.Buttons(iKey).Enabled = True Then
            ToolbarFunction iKey
        End If
    End If
End Sub

'Set Your Object
Private Sub Form_Load()
    Set FrmName = Me
    FormSetup
    
    Set rsHeader = New ADODB.Recordset
        AcessBit Me, GetValueFrTable("AccessLevel", "SEC_ACCESSLEVEL", "RoleID = '" & SecUserRole & "' AND [Module] = 'TL08'")
        ParamType = "USER"
        Caption = "Maintain - User Parameter [ComUnion]"
        lblType = "User Parameter"
        lblDetails = lblType
        BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, lACNew, , , , , , , , , True, , , True
    
'    If RepName = "USER" Then
'        AcessBit Me, GetValueFrTable("AccessLevel", "SEC_ACCESSLEVEL", "RoleID = '" & SecUserRole & "' AND [Module] = 'TL08'")
'        ParamType = "USER"
'        Caption = "Maintain - User Parameter [ComUnion]"
'        lblType = "User Parameter"
'        lblDetails = lblType
'        BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, lACNew, , , , , , , , , True, , , True
'    ElseIf RepName = "SYSTEM" Then
'        AcessBit Me, GetValueFrTable("AccessLevel", "SEC_ACCESSLEVEL", "RoleID = '" & SecUserRole & "' AND [Module] = 'TL07'")
'        ParamType = "SYSTEM"
'        Caption = "Maintain - System Parameter [ComUnion]"
'        lblType = "System Parameter"
'        lblDetails = lblType
'        BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, , , , , , , , , , True, , , True
'    End If
    
    FormLocking True
    BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, lACNew, , , , , , , , , True, , , True
    BitVisible ITGLedgerMain.tbrMain
    ITGLedgerMain.tbrMain.Buttons("btnFind").ButtonMenus("btnFindP").Enabled = True

    Mode = Find
    txtName.Locked = False
End Sub

'Activate your Toolbar Mode
Private Sub Form_Activate()
    TBBitReload
End Sub

'Release your Object
Private Sub Form_Unload(Cancel As Integer)
On Error Resume Next
    If Mode = AddNewEdit Then
        MsgBox "Unable to close. You are in Add/New/Edit mode." & vbCr & _
            " Must Save or Undo", vbCritical, Me.Caption
        Cancel = True
        Exit Sub
    End If
    
    CloseMenuTab ITGLedgerMain
    
    BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, , , , , , , , , , True
    BitVisible ITGLedgerMain.tbrMain
    ITGLedgerMain.tbrMain.Buttons("btnFind").ButtonMenus("btnFindP").Enabled = False
    
    
    
    
    
    Set rsHeader = Nothing
    Set connHeader = Nothing
    
    Set frmMaintParameter = Nothing

    lCloseWindow = True
    
'    'oForm(Me.Tag).Mode = 1
'    'oForm(Me.Tag).Tag = Me.Tag
End Sub

'Add new record to the recordset
Public Sub TBNew()
    
    BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, , , , , , , , True, True, , , , True
    txtName.BackColor = &HE0FFFF
    Mode = AddNewEdit
    
    If rsHeader.State <> adStateOpen Then
        OpenNewConnection connHeader
        OpenRecordsetWithCN rsHeader, "*", "PARAMETER_USER", connHeader, "WHERE 1 = 0 "
'        If ParamType = "USER" Then
'            OpenRecordsetWithCN rsHeader, "*", "PARAMETER_USER", connHeader, "WHERE 1 = 0 "
'        ElseIf ParamType = "SYSTEM" Then
'            OpenRecordsetWithCN rsHeader, "*", "PARAMETER_SYSTEM", connHeader, "WHERE 1 = 0 ", True
'        End If
        SetDataSource
        SetDataField
    Else
        vBM = rsHeader.Bookmark
    End If
    
    rsHeader.AddNew
    If ParamType = "USER" Then
        rsHeader!cCompanyID = COID
    End If
    
    Set FrmName = Me
    FormLocking False
    ClrRequired &HC0&
    txtName.SetFocus
    SSTab1.ActiveTab = 0

End Sub

'Undo all changes to the recordset
Public Sub TBUndoAll()
On Error GoTo ErrorHandler
   
    Mode = Normal
    
    If rsHeader.Status = adRecNew Then TBUndoCurrent
    
    rsHeader.CancelBatch adAffectAll
    
    UnbindControls
    
    If rsHeader.RecordCount <> 0 Then rsHeader.Bookmark = vBM
    
    Set FrmName = Me
    FormLocking True
    
    If rsHeader.RecordCount <> 0 Then
        BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, lACNew, lACEdit, lACDelete, , , , , , , True, True, , True
    Else
        RSZero
        Mode = Find
    End If
    
    sbRS.Panels(2) = ""

    SetDataSource
    SetDataField

    txtName.Locked = True

ErrorHandler:
    If err.Number = -2147217885 Then
        Resume Next
    ElseIf err.Number = -2147217842 Then 'Operation was cancelled. (Error returned by ITGDateBox)
        TBUndoAll
    End If

End Sub

'Undo changes on the current record
Public Sub TBUndoCurrent()
On Error GoTo ErrorHandler

    If rsHeader.Status = adRecNew Then
        rsHeader.CancelUpdate
    Else
        rsHeader.CancelBatch adAffectCurrent
    End If
   
    If rsHeader.RecordCount = 0 Then RSZero
    
ErrorHandler:
    If err.Number = -2147217885 Then
        Resume Next
    ElseIf err.Number = -2147217842 Then 'Operation was cancelled. (Error returned by ITGDateBox)
        TBUndoCurrent
    End If

End Sub

'Save all changes
Public Sub TBSave()
Dim OKUpdate As Boolean
On Error GoTo ErrHandler

    If Not MandatoryOK Then Exit Sub
    
    'Audit Trail
    lBoolean = False
    If rsHeader.Status = adRecNew Then lBoolean = True
    
    chkFormat_Click
    
    OKUpdate = False
    cn.BeginTrans
    connHeader.BeginTrans
    
    rsHeader.UpdateBatch adAffectAll
    
    cn.CommitTrans
    connHeader.CommitTrans
    OKUpdate = True
    
    Set FrmName = Me
    FormLocking True
    BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, lACNew, lACEdit, lACDelete, , , , , , , True, True, , True
    Mode = Normal
    
    MsgBox "Record/s successfully saved.", vbInformation, "ComUnion"
    
    'Audit trail
    UpdateLogFile "Parameter", Trim(txtName), IIf(lBoolean, "Inserted", "Updated")
    
    lblHeader = rsHeader!cParamName
    lblDetails = lblType
    sbRS.Panels(2) = ""

    txtName.Locked = True

ErrHandler:
    If err.Number = -2147217885 Then
        Resume Next
    ElseIf err.Number = -2147217864 Then
        OKUpdate = True
        cn.RollbackTrans
        connHeader.RollbackTrans
        MsgBox "Record cannot be updated. Some values may have been changed by other user/s since last read." & vbCr & _
                "Records will be automatically refreshed. All changes made to the record will be gone upon refresh.", vbInformation, "ComUnion"
        vBookMark = rsHeader.Bookmark
        UnbindControls
        rsHeader.Requery
        BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, lACNew, lACEdit, lACDelete, , , , , , , True, True, , True
        Mode = Normal
        If rsHeader.RecordCount <> 0 Then
            Set FrmName = Me
            FormLocking True
            SetDataField
            SetDataSource
            rsHeader.Bookmark = vBookMark
        Else
            RSZero
        End If
    End If
    
    If Not OKUpdate Then
        MsgBox "Transaction update failed.", vbInformation, "ComUnion"
        cn.RollbackTrans
        connHeader.RollbackTrans
        ErrorLog err.Number, err.Description, Me.Name 'Error log
    End If
    
End Sub

'Sets the form & recorset to add/edit mode
Public Sub TBEdit()
    If ParamType = "USER" Then
        'If rsHeader!cType = "SONO" Then
        If rsHeader!lNoEditDelete = False Then
        ElseIf rsHeader!lNoEditDelete = True Then
            MsgBox "Edit is not allowed for this parameter. [System Default]", vbCritical, "ComUnion"
            Exit Sub
        End If
    End If
    Mode = AddNewEdit
    BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, , , , , , , , True, True, , , , True
    Set FrmName = Me
    FormLocking False
    ClrRequired &HC0&
    txtName.Locked = True
    SSTab1.ActiveTab = 0
    vBM = rsHeader.Bookmark
    
    'FOR SI/DR Doc type printout parameters only
    If (Trim(txtType) = "SIDOCTYPE") Or (Trim(txtType) = "DRDOCTYPE") Then
        Frame2.Enabled = True
        txtName.Locked = False
    Else
        Frame2.Enabled = False
    End If
    
End Sub

'Delete record
Public Sub TBDelete()
On Error GoTo ErrorHandler
    
    If ParamType <> "USER" Then Exit Sub
    
    If rsHeader.RecordCount = 0 Then Exit Sub
    
    If rsHeader!lNoEditDelete = True Then
        MsgBox "Deletion is not allowed for this parameter. [System Default]", vbCritical, "ComUnion"
        Exit Sub
    End If

    If MsgBox("Are you sure you want to delete this record?", vbQuestion + vbYesNo, "ComUnion") = vbNo Then Exit Sub
    
    'Audit trail
    UpdateLogFile "User Parameter", Trim(txtName), "Deleted"

    rsHeader.Delete adAffectCurrent
    rsHeader.UpdateBatch adAffectAll
    
    TBPrevRec

    Mode = Normal
    
    If rsHeader.RecordCount = 0 Then
        RSZero
    End If

ErrorHandler:
    If err.Number = -2147217885 Then
        Resume Next
    End If

End Sub

'Search using the frmITGSearch
Public Sub TBFind()
    Mode = Normal
    txtName.Locked = True
    frmITGSearch.Show
End Sub

'Search using the recordset primary key
Public Sub TBFindPrimary()

        'Find
        If Mode = Find Then
        
            FormWaitShow App.Path & "\Transmit.avi", "Loading data . . ."
            
            OpenNewConnection connHeader
            
            Set rsHeader = Nothing
            Set rsHeader = New ADODB.Recordset
            
            If Trim(txtName) = "" Then
                OpenRecordsetWithCN rsHeader, "*", "PARAMETER_USER", connHeader
                
'                If ParamType = "USER" Then
'                    OpenRecordsetWithCN rsHeader, "*", "PARAMETER_USER", connHeader
'                ElseIf ParamType = "SYSTEM" Then
'                    OpenRecordsetWithCN rsHeader, "*", "PARAMETER_SYSTEM", connHeader, , True
'                Else
'                    OpenRecordsetWithCN rsHeader, "*", "PARAMETER_SYSTEM", connHeader, , True
'                End If
            Else
                OpenRecordsetWithCN rsHeader, "*", "PARAMETER_USER", connHeader, "WHERE cParamName LIKE '" & Trim(txtName) & "%'"
'                If ParamType = "USER" Then
'                    OpenRecordsetWithCN rsHeader, "*", "PARAMETER_USER", connHeader, "WHERE cParamName LIKE '" & Trim(txtName) & "%'"
'                ElseIf ParamType = "SYSTEM" Then
'                    OpenRecordsetWithCN rsHeader, "*", "PARAMETER_SYSTEM", connHeader, "WHERE cParamName LIKE '" & Trim(txtName) & "%'", True
'                End If
                
            End If
            
            Set FrmName = Me
            FormLocking True
            
            If rsHeader.RecordCount = 0 Then
                FormWaitHide
                MsgBox "No matching record/s found.", vbInformation, "ComUnion Search"
                rsHeader.Close
                If ParamType = "USER" Then
                    BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, lACNew, , , , , , , , , True, , , True
                ElseIf ParamType = "SYSTEM" Then
                    BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, , , , , , , , , , True, , , True
                End If
                txtName.Locked = False
                txtName.SetFocus
                Exit Sub
            End If
            
            SetDataSource
            SetDataField
            
            txtName.BackColor = &HE0FFFF
            Mode = Normal
            
            If ParamType = "USER" Then
                BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, lACNew, lACEdit, lACDelete, , , , , , , True, True, , True
            ElseIf ParamType = "SYSTEM" Then
                BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, , , , , , , , , , True, True, , True
            End If
        
            FormWaitHide
    Else
    RSZero
    Mode = Find
    End If
End Sub

'Reload menu buttons (do not delete this sub)
Public Sub TBBitReload()
    BitVisible ITGLedgerMain.tbrMain
    ITGLedgerMain.tbrMain.Buttons("btnFind").ButtonMenus("btnFindP").Enabled = True
    BitReload ITGLedgerMain, Me, ITGLedgerMain.tbrMain, sBit
    Set FrmName = Me
End Sub

'Close active window
Public Sub TBCloseWindow()
    Unload Me
End Sub

'Move first
Public Sub TBFirstRec()
    If rsHeader.State <> adStateOpen Then Exit Sub
    MoveFirst rsHeader
End Sub

'Move previous
Public Sub TBPrevRec()
    If rsHeader.State <> adStateOpen Then Exit Sub
    MovePrevious rsHeader
End Sub

'Move next
Public Sub TBNextRec()
    If rsHeader.State <> adStateOpen Then Exit Sub
    MoveNext rsHeader
End Sub

'Move last
Public Sub TBLastRec()
    If rsHeader.State <> adStateOpen Then Exit Sub
    MoveLast rsHeader
End Sub

'Add new line to the detail recordset
Public Sub TBNewLine()
    'Not available for this module
End Sub

'Delete line in the detail recordset
Public Sub TBDeleteLine()
    'Not avilable for this module
End Sub

'Undo all
Public Sub TBUndoLineAll()
    'Not available for this module
End Sub

'Undo current line
Public Sub TBUndoLineCurrent()
    'Not available for this module
End Sub

'Post current record
Public Sub TBPostRecord()
    'Not available for this module
End Sub

'Cancel current record
Public Sub TBCancelRecord()
    'Not available for this module
End Sub

'Print
Public Sub TBPrintRecord()
    MsgBox "Unavailable on " & Me.Name
End Sub

'Sets the data source of the controls
Sub SetDataSource()
    Set FrmName = Me
    BindControls rsHeader
    Set dtgList.DataSource = rsHeader
End Sub
    
'Sets the data field for every bounded controls
Sub SetDataField()
    With rsHeader
        txtName.DataField = !cParamName
        txtDesc.DataField = !cDesc
        txtModule.DataField = !cModule
        txtType.DataField = !cType
        txtValue.DataField = !cValue
        txtOrder.DataField = !nOrder
        txtPrefix.DataField = !cPrefix
        txtSeries.DataField = !cSeries
        txtFormat.DataField = !lFormat
        txtPlaces.DataField = !nPlaces
'        If RepName = "USER" Then
'            txtPrefix.DataField = !cPrefix
'            txtSeries.DataField = !cSeries
'            txtFormat.DataField = !lFormat
'            txtPlaces.DataField = !nPlaces
'        End If
    End With
End Sub

Private Sub rsHeader_MoveComplete(ByVal adReason As ADODB.EventReasonEnum, ByVal pError As ADODB.Error, adStatus As ADODB.EventStatusEnum, ByVal pRecordset As ADODB.Recordset)
On Error GoTo ErrorHandler
    
    If Not (rsHeader.EOF) Or Not (rsHeader.BOF) Then
        lblHeader = rsHeader!cParamName
        lblDetails = lblType
        sbRS.Panels(1) = "Record: " & IIf((rsHeader.AbsolutePosition = -2), "0", rsHeader.AbsolutePosition) & "/" & rsHeader.RecordCount
        
        If rsHeader.Status <> adRecNew Then
            txtName.Locked = True
        Else
            txtName.Locked = False
        End If
        
        If Mode = AddNewEdit Then
            Select Case rsHeader.Status
                Case adRecNew
                    sbRS.Panels(2) = "New"
                Case adRecModified
                    sbRS.Panels(2) = "Modified"
                Case Else
                    sbRS.Panels(2) = ""
            End Select
        Else
            sbRS.Panels(2) = ""
        End If
    Else
        lblHeader = "Parameter Name"
        lblDetails = lblType
        sbRS.Panels(1) = "Record: 0/0"
        sbRS.Panels(2) = ""
        txtName.Locked = False
    End If
    
ErrorHandler:
    'Err.Number -2147217885
    'Description - Row handle referred to a deleted row or a row marked for deletion.
    If err.Number = -2147217885 Then
        Resume Next
    End If
    
End Sub

Private Sub Timer1_Timer()
    If Mode <> Find Then Exit Sub
    If txtName.BackColor = &HE0FFFF Then
        txtName.BackColor = &HE0E0E0
        Exit Sub
    End If
    If txtName.BackColor <> &HE0FFFF Then
        txtName.BackColor = &HE0FFFF
        Exit Sub
    End If

End Sub

Private Sub txtFormat_Change()
    If rsHeader.RecordCount <> 0 Then
        If Not rsHeader.EOF And Not rsHeader.BOF Then
            If rsHeader!lFormat = True Then
                chkFormat.Value = Checked
            Else
                chkFormat.Value = Unchecked
            End If
        End If
    End If
End Sub

Private Sub txtName_LostFocus()
    'Not available in this module
End Sub

'Check if all mandatory fields are complete
Function MandatoryOK() As Boolean
Dim rsClone As New ADODB.Recordset
    
    MandatoryOK = True
    
    If Trim(txtName) = "" Then
        MandatoryOK = False
        MsgBox "Field 'Parameter Name' is mandatory. Null value is not allowed.", vbInformation, "ComUnion"
        txtName.SetFocus
        Exit Function
    End If

End Function

'Sets the form if record number is zero
Private Sub RSZero()
    lblHeader = "Parameter Name"
    lblDetails = lblType
    sbRS.Panels(1) = "Record: 0/0"
    sbRS.Panels(2) = ""
    
    Set FrmName = Me
    UnbindControls
    TextClearing
    FormLocking True
    
    If rsHeader.State = adStateOpen Then rsHeader.Close
     BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, lACNew, , , , , , , , , True, , , True
'    If ParamType = "USER" Then
'        BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, lACNew, , , , , , , , , True, , , True
'    ElseIf ParamType = "SYSTEM" Then
'        BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, , , , , , , , , , True, , , True
'    End If
    
    txtName.Locked = False
    txtName.SetFocus
    
    Mode = Find
End Sub

Private Sub txtPlaces_Change()
    If txtPlaces.Text > 15 Then txtPlaces.Text = 15
End Sub

Private Sub txtPrefix_KeyPress(KeyAscii As Integer)
    KeyAscii = Asc(UCase(Chr(KeyAscii)))
End Sub

Private Sub txtSeries_KeyPress(KeyAscii As Integer)
    KeyAscii = Asc(UCase(Chr(KeyAscii)))
End Sub


